"""
简化版: 通过用户名获取个人空间ID

直接使用封装好的方法进行测试
"""

import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from src.llm.hiagent_app.utils.api_client import HiAgentAPIClient


def main():
    """测试通过用户名获取工作空间ID"""
    print("=" * 60)
    print("Test: Get Workspace ID by Username")
    print("=" * 60)

    # 测试用户名
    username = "2013000032"

    try:
        client = HiAgentAPIClient()

        print(f"\nGetting workspace ID for username: {username}")
        workspace_id = client.get_workspace_by_username(username)

        print("\n" + "=" * 60)
        print("SUCCESS!")
        print(f"Username: {username}")
        print(f"WorkspaceID: {workspace_id}")
        print("=" * 60)

    except Exception as e:
        print("\n" + "=" * 60)
        print("FAILED!")
        print(f"Error: {e}")
        print("=" * 60)
        print("\nTroubleshooting:")
        print("1. Check if IAM AccessKey/SecretKey are correct")
        print("2. Check if the user exists in the system")
        print("3. Check if the user has a personal workspace")


if __name__ == "__main__":
    main()
